package com.hq.ims.data.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hq.ims.data.vo.AreaMapstruct;
import com.hq.mybatis.base.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;

/**
 * @author 蒋柏平
 * @since 20241031
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Alias("Area")
@TableName(value = "area")
@ApiModel(value = "区域", description = "区域")
public class Area extends BaseModel<Area> implements Serializable {

    @ApiModelProperty(value = "地区编码")
    @TableId(value = "area_id")
    private String areaId;

    @ApiModelProperty(value = "地区名称")
    @TableField(value = "area_name")
    private String areaName;

    @ApiModelProperty(value = "父ID")
    @TableField(value = "parent_id")
    private String parentId;

    @ApiModelProperty(value = "子数据数量")
    @TableField(value = "children_count")
    private Integer childrenCount;

    @ApiModelProperty(value = "根节点ID")
    @TableField(value = "root_id")
    private String rootId;

    public AreaMapstruct.AreaRowAuthVo auth() {
        AreaMapstruct.AreaRowAuthVo auth = new AreaMapstruct.AreaRowAuthVo(this);
        return auth;
    }

}
